updating oE set_decimal_mark
set_decimal_mark
include std/convert.e default namespace is convert public function set_decimal_mark(integer new_mark)
Gets, and possibly sets, the decimal mark that to_number uses.
Parameters:
- new_mark : An integer: Either a comma (,), a period (.) or any other integer.
Returns:
An integer, The current value, before new_mark changes it.
Example:
include std/convert.e atom n1 = to_number("12,345.95") ? n1 set_decimal_mark(',') atom n2 = to_number("12.345,95") ? n2
Results:
12345.95 12345.95
Comments:
- When new_mark is a period it will cause to_number to interpret a dot (.) as the decimal point symbol. The pre-changed value is returned.
- When new_mark is a comma it will cause to_number to interpret a comma (,) as the decimal point symbol. The pre-changed value is returned.
- Any other value does not change the current setting. Instead it just returns the current value.
- The initial value of the decimal marker is a period.
Not Categorized, Please Help
|